﻿//********************************************************************************//
//创建日期：<创建日期，2016-4-12>
//页面创建：<朱大鹏，zhudapeng@shanghai3h.com>
//后台逻辑：朱大鹏
//功能说明：托收退票
//********************************************************************************//
using System;
using BLL;
using BLL.Access;
using System.Data;

namespace Web.Pages.YongShui._6.ZhangWuGL
{
    public partial class TuoShouTPCX : BasePage
    {
        #region 属性
        /// <summary>
        /// 保存按照管理快查询退票信息数据
        /// </summary>
        public DataTable DataViewGLK
        {
            get { return ViewState["DataViewGLK"] != null ? ViewState["DataViewGLK"] as DataTable : null; }
            set { ViewState["DataViewGLK"]=value;}
        }
        /// <summary>
        /// 保存退票信息明细数据
        /// </summary>
        public DataTable DataViewMX
        {
            get { return ViewState["DataViewMX"] != null ? ViewState["DataViewMX"] as DataTable : null; }
            set { ViewState["DataViewMX"]=value;}
        }
        #endregion

        #region 变量
        /// <summary>
        /// 存储过程访问类
        /// </summary>
        SpHelper _sphelper = new SpHelper();
        #endregion

        #region 事件
        /// <summary>
        /// 页面初始化加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitControl();
            }
            gvGUANLIK.DataSource = DataViewGLK;
            gvGUANLIK.DataBind();

            gvMINGXI.DataSource = DataViewMX;
            gvMINGXI.DataBind();
        }

        /// <summary>
        /// 搜索绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnSelect_Click(object sender, EventArgs e)
        {
            BindGV();
        }
        #endregion

        #region 方法
        /// <summary>
        /// 初始化加载
        /// </summary>
        private void InitControl()
        {
            txtZhangWuNY.Text = BusinessTool.GetZWYM().ToString();
            BindGV();
        }
        /// <summary>
        /// 绑定gv
        /// </summary>
        private void BindGV()
        {
            int zwny = 0;
            int? ZongBiS = 0;
            string ZongJinE="" ;
            DataSet dsGLK = _sphelper.P_YS_ZW_TUOSHOUTBCX(0, Convert.ToInt32(txtZhangWuNY.Text), out ZongBiS, out ZongJinE);


            int? ZongBiS1 = 0;
            string ZongJinE1 = "";
            DataSet dsMX = _sphelper.P_YS_ZW_TUOSHOUTBCX(1, Convert.ToInt32(txtZhangWuNY.Text), out ZongBiS1, out ZongJinE1);

            DataViewGLK = dsGLK.Tables[0];
            DataViewMX = dsMX.Tables[0];

            gvGUANLIK.DataSource = DataViewGLK;
            gvGUANLIK.DataBind();

            gvMINGXI.DataSource = DataViewMX;
            gvMINGXI.DataBind();

            txtZongBiS.Text = ZongBiS.ToString();
            txtZBS.Text = ZongBiS1.ToString();

            txtZongJieE.Text = ZongJinE.ToString();
            txtZJE.Text = ZongJinE1.ToString();
            gvMINGXI.FocusedRowIndex = -1;
            gvGUANLIK.FocusedRowIndex = -1;
            if (gvMINGXI.VisibleRowCount > 0)
            {
                
                gvMINGXI.FocusedRowIndex = 0;
            }
            if (gvGUANLIK.VisibleRowCount > 0)
            {
               
                gvGUANLIK.FocusedRowIndex = 0;
            }
        }
        #endregion

        

    }
}